package com.haidechizi.util.lock.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.concurrent.TimeUnit;

@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Lock {

    String type() default "redisson";   // 默认使用Redisson分布式锁

    long timeout() default 1000;

    String lockKeyPrefix(); // lockKey

    String[] lockKeyExpression() default {};  // 动态参数，拼接到key上

    Class[] lockKeyArgsTypes() default {}; // 动态参数的类型

    String separator() default ":";

    TimeUnit timeUnit() default TimeUnit.MILLISECONDS;

}
